#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "DirectedRelationship.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class TemplateParameterSubstitution;
class TemplateSignature;
class TemplateableElement;

/// <summary>
/// TemplateBinding
/// A TemplateBinding is a DirectedRelationship between a TemplateableElement and a
/// template. A TemplateBinding specifies the TemplateParameterSubstitutions of
/// actual parameters for the formal parameters of the template.
/// </summary>
class UMLMODEL_EXPORT TemplateBinding : public DirectedRelationship {

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// boundElement getter
    /// The TemplateableElement that is bound by this TemplateBinding.
    /// </summary>
    shared_ptr<TemplateableElement> boundElement() const;

    /// <summary>
    /// boundElement setter
    /// The TemplateableElement that is bound by this TemplateBinding.
    /// </summary>
    void setBoundElement(shared_ptr<TemplateableElement> value);

    /// <summary>
    /// parameterSubstitutions getter
    /// The TemplateParameterSubstitutions owned by this TemplateBinding.
    /// </summary>
    vector<shared_ptr<TemplateParameterSubstitution>>& parameterSubstitutions();

    /// <summary>
    /// signature getter
    /// The TemplateSignature for the template that is the target of this
    /// TemplateBinding.
    /// </summary>
    shared_ptr<TemplateSignature> signature() const;

    /// <summary>
    /// signature setter
    /// The TemplateSignature for the template that is the target of this
    /// TemplateBinding.
    /// </summary>
    void setSignature(shared_ptr<TemplateSignature> value);

private: // Fields
    /// <summary>
    /// boundElement
    /// The TemplateableElement that is bound by this TemplateBinding.
    /// </summary>
    shared_ptr<TemplateableElement> boundElement_;

    /// <summary>
    /// parameterSubstitutions
    /// The TemplateParameterSubstitutions owned by this TemplateBinding.
    /// </summary>
    vector<shared_ptr<TemplateParameterSubstitution>> parameterSubstitutions_;

    /// <summary>
    /// signature
    /// The TemplateSignature for the template that is the target of this
    /// TemplateBinding.
    /// </summary>
    shared_ptr<TemplateSignature> signature_;

};

} // namespace uml
